package com.aspose.cells;

import java.util.HashMap;

class zcey {
   static int[] a(WorksheetCollection var0, byte[] var1, int var2, boolean var3, int var4, int var5, HashMap var6) {
      if (var1 != null && var1.length > 2) {
         int var7 = var1.length;
         if (var2 == -1) {
            var7 = com.aspose.cells.b.a.zc.a(var1, 0);
            var2 = 4;
         }

         int[] var8;
         switch(var1[var2]) {
         case 24:
            if (var1[var2 + 1] == 25 && var7 == 14) {
               return zbsg.a(var0, var1, var2, var4, var5, false);
            }
            break;
         case 57:
         case 89:
         case 121:
            if (var7 == 7) {
               int var12 = com.aspose.cells.b.a.zc.e(var1, var2 + 1) & '\uffff';
               zur var13 = var0.q().b(var12);
               if ((var13.a & '\uffff') == var0.u()) {
                  int var10 = com.aspose.cells.b.a.zc.e(var1, var2 + 3) & '\uffff';
                  Name var11 = var0.getNames().get(var10 - 1);
                  if (var6.get(var10) == null) {
                     var6.put(var10, var11);
                     return a(var0, var11.b(), -1, true, var4, var5, var6);
                  }

                  return null;
               }
            }
            break;
         case 58:
         case 90:
         case 122:
            if (var7 == 9) {
               var8 = new int[5];
               var8[0] = com.aspose.cells.b.a.zc.e(var1, var2 + 1) & '\uffff';
               if (var3) {
                  var8[1] = zcew.a(var1, var2 + 3, var4, var1[var2 + 8]);
                  var8[2] = zcew.b(var1, var2 + 7, var5, var1[var2 + 8]);
               } else {
                  var8[1] = com.aspose.cells.b.a.zc.a(var1, var2 + 3);
                  var8[2] = zcew.a(var1, var2 + 7);
               }

               var8[3] = var8[1];
               var8[4] = var8[2];
               return var8;
            }
            break;
         case 59:
         case 91:
         case 123:
            if (var7 == 15) {
               var8 = new int[]{com.aspose.cells.b.a.zc.e(var1, var2 + 1) & '\uffff', com.aspose.cells.b.a.zc.a(var1, var2 + 3), zcew.a(var1, var2 + 11), com.aspose.cells.b.a.zc.a(var1, var2 + 7), zcew.a(var1, var2 + 13)};
               int var9;
               if (var8[1] > var8[3]) {
                  var9 = var8[1];
                  var8[1] = var8[3];
                  var8[3] = var9;
               }

               if (var8[2] > var8[4]) {
                  var9 = var8[2];
                  var8[2] = var8[4];
                  var8[4] = var9;
               }

               return var8;
            }
         }

         return null;
      } else {
         return null;
      }
   }

   static String[] a(WorksheetCollection var0, int var1, int[] var2) {
      var2[0] = var0.q().c(var1);
      int var3 = var0.q().d(var1);
      String[] var4 = new String[2];
      if (var2[0] == var0.u()) {
         if (var3 >= 0 && var3 < var0.getCount()) {
            var4[1] = var0.get(var3).getName();
         } else {
            var4[1] = "#REF!";
         }
      } else {
         zbqg var5 = var0.v().a(var2[0]);
         var4[0] = var5.a(var0.n());
         if (var5.c() != null && var3 >= 0 && var3 < var5.c().length) {
            var4[1] = var5.c()[var3];
         } else {
            var4[1] = "#REF!";
         }
      }

      return var4;
   }

   static boolean a(WorksheetCollection var0, zboa var1, byte[] var2, int var3) {
      if (var2 != null && var2.length > 2) {
         int var4 = var2.length;
         if (var3 == -1) {
            var4 = com.aspose.cells.b.a.zc.a(var2, 0);
            var3 = 4;
         }

         boolean var5 = false;
         byte var6 = 0;
         String[] var7 = null;
         int[] var8;
         int var11;
         int var12;
         switch(var2[var3]) {
         case 35:
         case 67:
         case 99:
            if (var4 == 5) {
               Name var13 = var0.getNames().get((com.aspose.cells.b.a.zc.e(var2, var3 + 1) & '\uffff') - 1);
               return a(var0, var1, var13.b(), -1);
            }
            break;
         case 57:
         case 89:
         case 121:
            if (var4 == 7) {
               var11 = com.aspose.cells.b.a.zc.e(var2, var3 + 1) & '\uffff';
               var8 = new int[]{var6};
               var7 = a(var0, var11, var8);
               var12 = var8[0];
               var1.b = var7[0];
               var1.c = var7[1];
               if ("#REF!".equals(var7[1])) {
                  return false;
               }

               int var9 = (com.aspose.cells.b.a.zc.e(var2, var3 + 3) & '\uffff') - 1;
               if (var12 != var0.u()) {
                  return false;
               }

               Name var10 = var0.getNames().get(var9);
               return a(var0, var1, var10.b(), -1);
            }
            break;
         case 58:
         case 90:
         case 122:
            if (var4 == 9) {
               var11 = com.aspose.cells.b.a.zc.e(var2, var3 + 1) & '\uffff';
               var8 = new int[]{var6};
               var7 = a(var0, var11, var8);
               var12 = var8[0];
               var1.b = var7[0];
               var1.c = var7[1];
               var1.d = com.aspose.cells.b.a.zc.a(var2, var3 + 3);
               var1.e = zcew.a(var2, var3 + 7);
               var1.f = var1.d;
               var1.g = var1.e;
               var1.h = var1.i = (var2[var3 + 8] & 255 & 128) == 0;
               var1.j = var1.k = (var2[var3 + 8] & 255 & 64) == 0;
               return "#REF!".equals(var7[1]);
            }
            break;
         case 59:
         case 91:
         case 123:
            if (var4 == 15) {
               var11 = com.aspose.cells.b.a.zc.e(var2, var3 + 1) & '\uffff';
               var8 = new int[]{var6};
               var7 = a(var0, var11, var8);
               var12 = var8[0];
               var1.b = var7[0];
               var1.c = var7[1];
               var1.d = com.aspose.cells.b.a.zc.a(var2, var3 + 3);
               var1.f = com.aspose.cells.b.a.zc.a(var2, var3 + 7);
               var1.e = zcew.a(var2, var3 + 11);
               var1.g = zcew.a(var2, var3 + 13);
               var1.h = (var2[var3 + 12] & 255 & 128) == 0;
               var1.j = (var2[var3 + 12] & 255 & 64) == 0;
               var1.i = (var2[var3 + 14] & 255 & 128) == 0;
               var1.k = (var2[var3 + 14] & 255 & 64) == 0;
               return "#REF!".equals(var7[1]);
            }
         }

         return false;
      } else {
         return false;
      }
   }

   static byte[] a(WorksheetCollection var0, int var1, CellArea var2) {
      Object var3 = null;
      int var4 = var0.q().b(var0.u(), var1);
      byte[] var5;
      if (var2.StartRow == var2.EndRow && var2.StartColumn == var2.EndColumn) {
         var5 = new byte[17];
         var5[0] = 9;
         var5[4] = 58;
         zcew.a(var5, 7, var2.StartRow, 0, true, false);
         zcew.c(var5, 11, var2.StartColumn, 0, true, false);
      } else {
         var5 = new byte[23];
         var5[0] = 15;
         var5[4] = 59;
         zcew.a(var5, 7, var2.StartRow, 0, true, false);
         zcew.a(var5, 11, var2.EndRow, 0, true, false);
         zcew.c(var5, 15, var2.StartColumn, 0, true, false);
         zcew.c(var5, 17, var2.EndColumn, 0, true, false);
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a(var4), 0, var5, 5, 2);
      return var5;
   }
}
